
#pragma once

#include "core/olisp_core.h"

/*
 * checks whether textual representation of e (if it can be converted to it) equals to str
 */
int lisp_strcmp( obj_t * e, const char * str );

/*
 * checks whether two given elements equal to each other
 */
int lisp_equal( obj_t * lhs, obj_t * rhs );

/*
 * creates an element's copy
 * returns 0 if failed
 */
obj_t * lisp_clone_elem( obj_t * elem );


/*
 * this is for registering functions in a lisp interpreter
 */
#define LISP_REGISTER_FUNC(name, lf_proto) \
    id_name = (obj_t *)create_identifier( name ); \
    if( !id_name ) \
        return 0; \
    result = interpreter_add_func( interpreter, id_name, lf_proto ); \
    if( !result ) \
    { \
        RELEASE( id_name ); \
        return 0; \
    }


#define LISP_REGISTRATION_FUNC_BEGIN( reg_func_name ) \
    int reg_func_name( interpreter_t * interpreter ) \
    { \
        obj_t * id_name; \
        int result;

#define LISP_REGISTRATION_FUNC_END() \
        return 1; \
    }
